﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using Kevin.Shop.Business.Service.Entity.Core.Member;
using RiderShop.Mobile.Modle;
using Kevin.Shop.Business.Core.Components;
using Kevin.Shop.Business.Products.Components;
using Kevin.Shop.Business.Service.Entity.Products.Enumerations;
using System.Collections.Specialized;
using RiderShop.Mobile.Common.Component;
using Kevin.Shop.Business.Comments.Components;
using RiderShop.Mobile.Modle;
using RiderShop.Mobile.ServiceEntity.Product;
using Kevin.Shop.Business.Service.Entity.SalesManagement.Shipping;
using Kevin.Shop.Business.Core.Components.Responser;
using RiderShop.Mobile.ServiceEntity.MyAccount;
using Kevin.Shop.Business.Service.Entity.Helper;
using RiderShop.Mobile.ServiceEntity;
using RiderShop.Mobile.Modle.MyAccount;

namespace RiderShop.WebSite.Controllers.MyAccount
{
    public partial class MyAccountController : ThemeController
    {
        #region get my all point
        /// <summary>
        /// 我的我的全部积分列表
        /// </summary>
        /// <param name="pageIndex">当前页的索引</param>
        /// <returns>积分集合</returns>
        [HttpGet]
        [Authorize]
        public ActionResult MyPoint(int pageIndex = 0)
        {
            MyPointModel myPointModel = new MyPointModel();
            DbQueryResult<List<CustomerPointInfo>> result = myPointModel.GetUserPoint(pageIndex, WebClientContext.CON_PageSize);
            if (result != null && result.Data.Count > 0)
            {
                myPointModel.PointList = result.Data;

                return View(WebClientContext.Current.SiteTheme, "MyAccount", "MyPoint", "_MobileLayout", myPointModel);
            }
            return View(WebClientContext.Current.SiteTheme, "MyAccount", "MyPoint", "_MobileLayout", myPointModel);
        }

        /// <summary>
        /// 得到我的全部积分列表
        /// </summary>
        /// <param name="pageIndex">当前页的索引</param>
        /// <returns>积分集合</returns>
        [HttpGet]
        public JsonResult MyPointByAjaxRequest(int pageIndex)
        {
            MyPointModel myPointModel = new MyPointModel();
            DbQueryResult<List<CustomerPointInfo>> result = myPointModel.GetUserPoint(pageIndex, WebClientContext.CON_PageSize);

            return Json(result.Data, JsonRequestBehavior.AllowGet);
        }
        #endregion       
    }
}
